<template>
  <el-form :model="formData" :rules="rules" ref="form">
    <el-row>
      <el-form-item label="城市" prop="id">
        <el-input v-model="city" placeholder="请输入城市"></el-input>
      </el-form-item>
      <el-form-item label="入住时间" prop="name">
        <el-input v-model="date" placeholder="请输入时间"></el-input>
      </el-form-item>
      <div style="font-size:12px;color:#999">*此服务由携程网提供</div>
    </el-row>
    <el-button class="submit" @click="onSubmit">找酒店</el-button>
  </el-form>
</template>

<script lang="ts">
import { defineComponent, ref, reactive, computed } from 'vue';
export default defineComponent({
  name: 'Hotel',
  setup() {
    const city = ref('');
    const date = ref('');
    const url = computed(() => {
      return (
        'https://hotels.ctrip.com/hotels/listPage?cityename=' +
        city +
        '&city=1&checkin=' +
        date
      );
    });
    const onSubmit = () => {
      console.log('1');
      window.open(url.value);
    };
    return {
      city,
      date,
      onSubmit,
    };
  },
});
</script>

<style lang="scss" scoped>
@import '@/assets/css/config.scss';
:deep(.el-input__inner) {
  width: 250px;
  margin-right: 20px;
}
//提交按钮
.submit {
  background-color: $themeRed;
  color: white;
  width: 300px;
  font-size: 20px;
  letter-spacing: 20px;
  padding-left: 38px;
  float: right;
  margin-top: 50px;
  margin-right: 20px;
}
</style>
